package com.epigeon.amadeo.impl;

import java.util.LinkedList;
import java.util.List;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;

import com.epigeon.amadeo.model.Message;
import com.epigeon.amadeo.model.StringMessage;
import com.epigeon.amadeo.modifier.Modifier;
import com.epigeon.amadeo.output.Output;

public class PassiveTextView extends TextView implements Output {

	private List<Modifier> modifierList; 
	
	public PassiveTextView(Context context, AttributeSet attrs) {
		super(context, attrs);
		this.modifierList = new LinkedList<Modifier>();
	}


	@Override
	public void addModifier(Modifier modifier) {
		this.modifierList.add(modifier);		
	}

	@Override
	public List<Modifier> getModifierList() {
		return modifierList;
	}

	@Override
	public void putMessage(Message message) {
		if ( message instanceof StringMessage == false ) {
			throw new IllegalArgumentException("Message not of type StringMessage");
		}
		StringMessage smessage = (StringMessage) message;
		this.setText(smessage.getValue());
	}

}
